import { NgModule }             from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

import { AppComponent } from './app.component';
import { AddComponent } from './add.component';
import { EditComponent } from './edit.component';
import { DetailsComponent } from './details.component';
import { ListComponent } from './list.component';
import {PageNotFoundComponent} from './pageNotFound.component'

const routes: Routes = [
  { path: 'add',component: AddComponent },
  { path: 'edit/:id',component: EditComponent },
  { path: 'details/:id',component: DetailsComponent },
  { path: 'list',component: ListComponent },
  { path: '',
    redirectTo: '/list',
    pathMatch: 'full'
  },
  { path: '**', component: PageNotFoundComponent }
];

@NgModule({
  imports: [ RouterModule.forRoot(routes) ],
  exports: [ RouterModule ]
})
export class AppRoutingModule {}
